<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>成绩管理 - 音乐考试系统</title>
    <style>
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family: 'Microsoft YaHei', Arial, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            padding: 20px;
        }
        .container { max-width: 1200px; margin: 0 auto; }
        .header {
            background: white;
            padding: 30px;
            border-radius: 15px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
            margin-bottom: 30px;
            text-align: center;
        }
        .title { color: #333; font-size: 28px; margin-bottom: 10px; }
        .btn {
            display: inline-block;
            padding: 12px 25px;
            background: #667eea;
            color: white;
            text-decoration: none;
            border-radius: 8px;
            font-weight: bold;
            transition: all 0.3s ease;
            margin: 10px;
        }
        .btn:hover { background: #5a6fd8; transform: translateY(-2px); }
        .record-card {
            background: white;
            padding: 25px;
            border-radius: 12px;
            margin-bottom: 20px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
            transition: all 0.3s ease;
        }
        .record-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 25px rgba(0,0,0,0.15);
        }
        .record-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
        }
        .student-info { color: #333; font-weight: bold; font-size: 18px; }
        .exam-info { color: #666; margin: 5px 0; }
        .score {
            font-size: 24px;
            font-weight: bold;
            color: #28a745;
        }
        .no-data {
            text-align: center;
            color: #666;
            padding: 60px 20px;
            background: white;
            border-radius: 15px;
            font-style: italic;
        }
        .delete-btn {
            background: #dc3545;
            color: white;
            border: none;
            padding: 8px 15px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            margin-top: 10px;
            transition: all 0.3s ease;
        }
        .delete-btn:hover {
            background: #c82333;
            transform: translateY(-2px);
        }
        .record-actions {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 10px;
        }
        .score-excellent { color: #28a745; }
        .score-good { color: #17a2b8; }
        .score-average { color: #ffc107; }
        .score-poor { color: #dc3545; }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1 class="title">👨‍🎓 学生成绩管理</h1>
            <p style="color: #666;">查看所有学生的考试记录</p>
            <a href="/dashboard" class="btn">返回主页</a>
        </div>

        {% if records %}
            {% for record in records %}
            <div class="record-card">
                <div class="record-header">
                    <div class="student-info">{{ record.student.username }}</div>
                    <div class="score 
                        {% if record.score >= 90 %}score-excellent
                        {% elif record.score >= 70 %}score-good
                        {% elif record.score >= 60 %}score-average
                        {% else %}score-poor{% endif %}">
                        {{ record.score }}分
                    </div>
                </div>
                <div class="exam-info">
                    <strong>{{ record.exam.title }}</strong> - {{ record.exam.exam_type or '常规测试' }}
                </div>
                <div class="exam-info">
                    提交时间: {{ record.submitted_at.strftime('%Y-%m-%d %H:%M') }}
                </div>
                <div class="record-actions">
                    <div></div>
                    <button class="delete-btn" onclick="if(confirm('确定要删除这条记录吗？')) window.location.href='/delete_record/{{ record.id }}'">删除记录</button>
                </div>
            </div>
            {% endfor %}
        {% else %}
            <div class="no-data">
                📊 暂无学生考试记录
            </div>
        {% endif %}
    </div>
</body>
</html>